ip#!/bin/bash
ip=`wget -qO- ipv4.icanhazip.com`;
owner=`cat /root/name`;
host=`hostname`;
squidports=`netstat -tunlp | grep squid | grep -vE 'udp' | awk '{print substr($4,4); }' > /tmp/squid.txt && echo | cat /tmp/squid.txt | tr '\n' ' ' > /etc/VpsPackdir/squidports.txt && cat /etc/VpsPackdir/squidports.txt`;
sslports=`netstat -tunlp | grep stunnel4 | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/ssl.txt && echo | cat /tmp/ssl.txt | tr '\n' ' ' > /etc/VpsPackdir/sslports.txt && cat /etc/VpsPackdir/sslports.txt`;
sshports=`netstat -tunlp | grep sshd | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/ssh.txt && echo | cat /tmp/ssh.txt | tr '\n' ' ' > /etc/VpsPackdir/sshports.txt && cat /etc/VpsPackdir/sshports.txt`;
dantedports=`netstat -tunlp | grep danted | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/danted.txt && echo | cat /tmp/danted.txt | tr '\n' ' ' > /etc/VpsPackdir/dantedports.txt && cat /etc/VpsPackdir/dantedports.txt`;
sockdports=`netstat -tunlp | grep sockd | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/sockd.txt && echo | cat /tmp/sockd.txt | tr '\n' ' ' > /etc/VpsPackdir/sockdports.txt && cat /etc/VpsPackdir/sockdports.txt`;
microports=`netstat -tunlp | grep microsocks | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/micro.txt && echo | cat /tmp/micro.txt | tr '\n' ' ' > /etc/VpsPackdir/microports.txt && cat /etc/VpsPackdir/microports.txt`;
dropbearports=`netstat -tunlp | grep dropbear | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/dropbear.txt && echo | cat /tmp/dropbear.txt | tr '\n' ' ' > /etc/VpsPackdir/dropbearports.txt && cat /etc/VpsPackdir/dropbearports.txt`;
pythonports=`netstat -tunlp | grep python | grep -vE '127.0.0.1' | awk '{print substr($4,9); }' > /tmp/python.txt && echo | cat /tmp/python.txt | tr '\n' ' ' > /etc/VpsPackdir/pythonports.txt && cat /etc/VpsPackdir/pythonports.txt`;
badvpnports=`netstat -tunlp | grep badvpn-udpg | grep tcp | awk '{print substr($4,11); }' > /tmp/badvpn.txt && echo | cat /tmp/badvpn.txt | tr '\n' ' ' > /etc/VpsPackdir/badvpnports.txt && cat /etc/VpsPackdir/badvpnports.txt`;
openvpnports=`netstat -tunlp | grep openvpn | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/openvpn.txt && echo | cat /tmp/openvpn.txt | tr '\n' ' ' > /etc/VpsPackdir/openvpnports.txt && cat /etc/VpsPackdir/openvpnports.txt`;
nginxports=`netstat -tunlp | grep nginx | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/nginx.txt && echo | cat /tmp/nginx.txt | tr '\n' ' ' > /etc/VpsPackdir/nginxports.txt && cat /etc/VpsPackdir/nginxports.txt`;
obfsports=`netstat -tunlp | grep obfs | grep 0.0.0.0: | awk '{print substr($4,9); }' > /tmp/obfs.txt && echo | cat /tmp/obfs.txt | tr '\n' ' ' > /etc/VpsPackdir/obfsports.txt && cat /etc/VpsPackdir/obfsports.txt`;
v2rayports=`netstat -tunlp | grep v2ray | grep LISTEN | grep -vE '127.0.0.1' | awk '{print substr($4,4); }' > /tmp/v2.txt && echo | cat /tmp/v2.txt | tr '\n' ' ' > /etc/VpsPackdir/v2ports.txt && cat /etc/VpsPackdir/v2ports.txt`;
cloakports=`netstat -tunlp | grep ck-server | grep LISTEN | grep -vE '127.0.0.1' | awk '{print substr($4,4); }' > /tmp/cloak.txt && echo | cat /tmp/cloak.txt | tr '\n' ' ' > /etc/VpsPackdir/cloakports.txt && cat /etc/VpsPackdir/cloakports.txt`;
shadowrports=`netstat -tunlp | grep python | grep ::: | awk '{print substr($4,4); }' > /tmp/shadowr.txt && echo | cat /tmp/shadowr.txt | tr '\n' ' ' > /etc/VpsPackdir/shadowrports.txt && cat /etc/VpsPackdir/shadowrports.txt`;
psiports=`netstat -tunlp | grep psiphond | grep 0.0.0.0: | awk '{print substr($4,17); }' > /tmp/psi.txt && echo | cat /tmp/psi.txt | tr '\n' ' ' > /etc/VpsPackdir/psiports.txt && cat /etc/VpsPackdir/psiports.txt`;
distribution=$(lsb_release -si);
os_version=$(lsb_release -sr);
service openvpn start 1> /dev/null 2> /dev/null
if [ $(id -u) -eq 0 ]
then
echo -e "\033[1;32mᇅ Nombre del nuevo usuario:\033[0;37m"; read -p " " name
echo -e "\033[1;32mᇅ Contraseña del nuevo usuario $name:\033[0;37m"; read -p " " pass
echo -e "\033[1;32mᇅ Cuantos dias durara la cuenta $name:\033[0;37m"; read -p " " daysrnf
echo -e "\033[1;32mᇅ Limite de logins simultaneos:\033[0;37m"; read -p " " limiteuser
echo -e "\033[0m"
if cat /etc/passwd |grep $name: |grep -vi [a-z]$name |grep -v [0-9]$name > /dev/null
then
echo -e "\033[1;31mUsuario $name ya existe\033[0m"
else
valid=$(date '+%C%y-%m-%d' -d " +$daysrnf days")
datexp=$(date "+%d/%m/%Y" -d "+ $daysrnf days")
useradd -M -s /bin/false $name -e $valid
( echo "$pass";echo "$pass" ) | passwd $name 2> /dev/null
limite $name $limiteuser
clear
cat /etc/VpsPackdir/logo
echo -e " "
echo -e "\033[1;37m      【     ★ VPSPack ★     】\033[0m"
echo -e "[\033[1;31m-\033[1;33m]\033[1;31m ═───────◇───────═\033[1;33m"
echo -e "\033[1;37m › ☬[•] VPS [•]☬:   $host \033[0m"
echo -e "[\033[1;31m-\033[1;33m]\033[1;31m ═───────◇───────═\033[1;33m"
echo -e "\033[1;31mᗚ Usuario • ๛ \033[0m $name"
echo -e "\033[1;31mᗚ Contraseña • ๛ \033[0m $pass"
echo -e "\033[1;31mᗚ Expira • \033[0m $datexp"
echo -e "\033[1;31mᗚ Limite • \033[0m $limiteuser"
echo -e "VPSPack Script"
echo -e "\033[1;37m࿂ SSH • \033[0m $sshports"
echo -e "\033[1;37m࿂ SSL • \033[0m $sslports"
echo -e "\033[1;37m࿂ Squid • \033[0m $squidports"
echo -e "\033[1;37m࿂ Dropbear • \033[0m $dropbearports"
echo -e "\033[1;37m࿂ SS Obfs • \033[0m $obfsports"
echo -e "\033[1;37m࿂ SS R • \033[0m $shadowrports"
echo -e "\033[1;37m࿂ OpenVPN • \033[0m $openvpnports"
echo -e "\033[1;37m࿂ Socks5 • \033[0m $dantedports"
echo -e "\033[1;37m࿂ Python • \033[0m $pythonports"
echo -e "\033[1;37m࿂ Cloak • \033[0m $cloakports"
echo -e "\033[1;37m࿂ v2ray • \033[0m $v2rayports"
echo -e "[\033[1;31m-\033[1;33m]\033[1;31m ═───────◇───────═\033[1;33m"
echo -e "\033[1;37m࿂ Badvpn • \033[0m $badvpnports"
echo -e "[\033[1;31m-\033[1;33m]\033[1;31m ═───────◇───────═\033[1;33m"
echo -e "\033[1;37m ›\033[0m☬[•] $owner [•]☬"
echo -e "[\033[1;31m-\033[1;33m]\033[1;31m ═───────◇───────═\033[1;33m"
echo "$pass" > /etc/VpsPackdir/senha/$name
echo "$name $limiteuser" >> /root/usuarios.db
usermod -p $(openssl passwd -1 $pass) $name
while [[ ${newfile} != @(s|S|y|Y|n|N) ]]; do
read -p "Crear Archivo Openvpn? [S/N]: " -e -i S newfile
tput cuu1 && tput dl1
done
if [[ ${newfile} = @(s|S) ]]; then
cp /etc/openvpn/client-common.txt /root/$name.ovpn
echo "<key>
$(cat /etc/openvpn/client-key.pem)
</key>
<cert>
$(cat /etc/openvpn/client-cert.pem)
</cert>
<ca>
$(cat /etc/openvpn/ca.pem)
</ca>" >> /root/$name.ovpn
while [[ ${ovpnauth} != @(s|S|y|Y|n|N) ]]; do
read -p "Colocar la autenticacion de usuario en el archivo? [S/N]: " -e -i S ovpnauth
tput cuu1 && tput dl1
done
[[ ${ovpnauth} = @(n|N) ]] && sed -i "s;auth-user-pass;<auth-user-pass>\n$name\n$pass\n</auth-user-pass>;g" /root/$name.ovpn
cd /root
zip ./$name.zip ./$name.ovpn > /dev/null 2>&1
rm ./$name.ovpn > /dev/null 2>&1
echo -e "Archivo creado: (/root/$name.zip)"
cp ./$name.zip /var/www/html/openvpn/$name.zip
cp ./$name.zip /home/vps/public_html/$name.zip
echo "Archivo OVPN copiado a su carpeta publica de VPS"
echo "El archivo se encontrara en :"
echo "http://suip:85/openvpn/$name.zip"
fi
echo -e "\033[1;31mPRESIONE ENTER PARA CONTINUAR\033[0m"
read -p " "
vpspack 2
fi
else
if echo $(id) |grep sudo > /dev/null
then
echo "Su usuario esta en el grupo root"
echo -e "Para para cambiar teclee \033[1;31msudo su\033[0m"
echo -e "O ejecute crearusuario como root. \033[1;31msudo crearusuario\033[0m"
else
echo -e "Usted ya esta como usuario root no necesita (sudo)\nPara ejecutar como root \033[1;31msu\033[0m y digite su contraseña root"
fi
fi